'''
Cookie的常用方法：
(1)get_cookies()		获取所有的cookie信息
(2)add_cookie(cookie_dict)				添加cookie。cookie_dict指字典对象，必须有name和value值
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from options import options

driver = webdriver.Chrome(options=options)
driver.get(r'https://www.baidu.com/')
sleep(1)

cookie = {'name': 'test01', 'value': '123'}
driver.add_cookie(cookie)  # 添加 cookie

for cookie in driver.get_cookies():
    print(f"{cookie['name']}-----{cookie['value']}")
sleep(3)
driver.quit()